package com.weisy.signin.network;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * @author weisy
 * @function 服务器配置
 * @date 2019/3/22 20:25
 */
public class WebConfig implements Parcelable {
    //ip地址
    private String address;
    //端口号
    private int port;
    //最大监听数
    private int maxParallels;

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public int getPort() {
        return port;
    }

    public void setPort(int port) {
        this.port = port;
    }

    public int getMaxParallels() {
        return maxParallels;
    }

    public void setMaxParallels(int maxParallels) {
        this.maxParallels = maxParallels;
    }

    public WebConfig(String address, int port, int maxParallels) {
        this.address = address;
        this.port = port;
        this.maxParallels = maxParallels;
    }

    protected WebConfig(Parcel in) {
        address = in.readString();
        port = in.readInt();
        maxParallels = in.readInt();
    }

    public static final Creator<WebConfig> CREATOR = new Creator<WebConfig>() {
        @Override
        public WebConfig createFromParcel(Parcel in) {
            return new WebConfig(in);
        }

        @Override
        public WebConfig[] newArray(int size) {
            return new WebConfig[size];
        }
    };

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(address);
        dest.writeInt(port);
        dest.writeInt(maxParallels);
    }

    @Override
    public String toString() {
        return "\"WebConfig\": {" +
                "\"address\": \"" + address + '\"' +
                ", \"port\": \"" + port +
                ", \"maxParallels\": \"" + maxParallels +
                '}';
    }
}
